from src.bean.config_column_enum import ConfigColumnEnum
from src.model.common.train import common_train
from src.model.model_common_util import get_df_by_path
from src.model.v1.v1_pre_handle import v1_pre_handle
from src.util.common_util import printx
from src.util.config_manager import ConfigManager
from src.util.file_selector_util import select_multi_file


def v1_first_train_entrance(config: ConfigManager) -> None:
    model_id = config.get_new_id()
    file_path_list = select_multi_file(config.get_config(ConfigColumnEnum.use_terminal.value))
    if len(file_path_list) == 0:
        printx("请重新选择文件")
        return
    df, files = get_df_by_path(file_path_list)
    printx("[预处理]开始预处理")
    v1_pre_handle(df, model_id)
    common_train(config, files, model_id, df, "none")
